It is called the "Baptism of desire.
http://www.catholicapologetics.info/modernproblems/currenterrors/bapdesire.htm
The Early Church Fathers on Salvation Outside the Church [Catholic/Orthodox Caucus]