Jami` at-Tirmidhi, Book 29, Hadith 24 (Tirmidhi 2180)

Amr bin Shu'aib narrated from his father, from his grandfather, that the Messenger of Allah(S.A.W) said:

"Any man who fornicates with a free woman, or a slave woman, then the child born from Zina does not inherit, nor is it inherited from."