From the Baltimore Catechism;
Q. 510. Is it ever possible for one to be saved who does not know the Catholic Church to be the true Church?A. It is possible for one to be saved who does not know the Catholic Church to be the true Church, provided that person:
1.(1) Has been validly baptized;
2.(2) Firmly believes the religion he professes and practices to be the true religion, and
3.(3) Dies without the guilt of mortal sin on his soul.
Q. 511. Why do we say it is only possible for a person to be saved who does not know the CatholicChurch to be the true Church?A. We say it is only possible for a person to be saved who does not know the Catholic Church to be the true Church, because the necessary conditions are not often found, especially that of dying in a state of grace without making use of the Sacrament of Penance.
Q. 512. How are such persons said to belong to the Church?A. Such persons are said to belong to the "soul of the church"; that is, they are really members of the Church without knowing it. Those who share in its Sacraments and worship are said to belong to the body or visible part of the Church.
https://www.catholicnewsagency.com/resources/catechism/baltimore-catechism/lesson-11-on-the-church