It is narrated from Sayyiduna Amr bin Kharijah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Allah has given every rightful claimant his due right. No bequest is permissible for an heir. The child belongs to the (lawful) bed, and for the fornicator is the stone. Whoever attributes himself to someone other than his father, or attributes himself to someone other than his patrons, upon him is the curse of Allah."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14140