Funerals (Al-Janaa'iz)
Bukhari :: Book 2 :: Volume 23 :: Hadith 440
Narrated Ibn Shihab:
The funeral prayer should be offered for every child even if he were the son of a prostitute as he was born with a true faith of Islam (i.e. to worship none but Allah Alone). If his parents are Muslims, particularly the father, even if his mother were a non-Muslim, and if he after the delivery cries (even once) before his death (i.e. born alive) then the funeral prayer must be offered. And if the child does not cry after his delivery (i.e. born dead) then his funeral prayer should not be offered, and he will be considered as a miscarriage. Abu Huraira, narrated that the Prophet said, "Every child is born with a true faith (i.e. to worship none but Allah Alone) but his parents convert him to Judaism or to Christianity or to Magainism, as an animal delivers a perfect baby animal. Do you find it mutilated?" Then Abu Huraira recited the holy verses: 'The pure Allah's Islamic nature (true faith i.e. to worship none but Allah Alone), with which He has created human beings.' " (30.30).