Pope Pius XII explained the Catholic position on Extra Ecclesia, or outside of the Church in a manner similar to this.
Our Lord established one Church, that is the Church founded on Peter, it is the means He gave us to get to heaven. Anyone who is baptized is a member of that Church, as there is generally only one baptism*, not a Catholic Baptism and an Orthodox Baptism and another Protestant Baptism. All that is needed is potable water, the words I baptize thee in the name of the Father and of the Son and of the Holy Ghost. (The thee and Ghost can be spirit and you, the language is not important) and the intention to do what the Church does, or at the very least the intention to preform an act that is sacred to Christians. So even a pagan can baptize someone if they use the proper form, and the person requests it.
Many have fallen away from the Church after baptism, some even moments after by assenting to heretical teachings of non-Catholic Churches. That does not mean they where not baptized. Those people fall into two groups, Vincibly Ignorant, and Invincibly Ignorant. Someone who is invincibly ignorant is someone who has been trained or taught such hatred for the Catholic Church, or has false information for the Teachings and history of the Church that they are unable to open their hearts and minds to the teachings of the Church. God will judge them based on what they knew and understood, He will continue to try to reveal Himself and the Fullness of the Truth to them, and we as Catholics should try to be an example of the Truth to them bu practicing our Faith with the love and Joy that comes from the Graces we have had made availible to us in the Sacraments and the spiritual life with Christ. We cannot as some do condemn anyone to hell or even proclaim them to be in hell for not following the teachings of the Church because we cannot judge them only God can.
For those who have never heard of the Teachings of the Church, ie pagans in Africa, Buddhists in Asia, God will Judge them according to His will, while we should try to spread the news of Christ as He commanded us to go unto the entire world, we need not obsess over judging those who never had the chance to hear the truth. The Church speculates, but does not pronounce that probably God will judge them using Natural Theology, or the common understanding of what is moral and immoral that all men being created by God understand, or possibly He enlightens them to the Truths of Himself and lets them choose between Him and rejecting Him. We do not know as He has not revealed that to us.
It is only those who understand the Faith and reject God that will be rejected by Him. As we cannot see the state of someones soul we can’t judge them.
* The two other forms of baptism that the Church holds are Baptism of Blood, and Baptism of Desire. If someone has not been baptized and is Killed for his belief in the Faith, as sometimes happened in the Early Church, he is considered baptized. If someone dies (non-martyrs) without the opportunity of being baptized but desired to be that is baptism of desire. An example of this would be the nephew of a woman I know. Her sister and brother became Protestant, and did not baptize their son. As an adult, at the age of 19 he started taking instruction in the Catholic Faith. His baptism was scheduled for Holy Saturday a few years ago. While attending a function for work he was killed, not having been baptized but his intention was to be baptized, so he we can assume had the baptism of desire.
As far as the graces that any Non-Catholic person recieves. they recieve them from the superabundant graces that God gives mankind through the Church, as His means of dispensing grace. “Overflow” as it where, not through the merits of Non-Catholic practices or Churches.
Summing it up, God wills all to be saved, and will do all He can to provide the graces needed for salvation. If one knows better, one should act better, if one is ignorant of the truth God will judge us based on what we knew. Otherwise Hell would be full, the Mentally Retarded who are so severly disabled that they could not follow the precepts of the Evangelicals, would all go to hell, little children who had not made the “Decision for Christ” would join them there, and very few would share eternity with Him.