The Prophet ﷺ decided regarding one who was treated as a member of a family after the death of his father, to whom he was attributed when the heirs said he was one of them, that if he was the child of a slave-woman whom the father owned when he had intercourse with her, he was included among those who sought his inclusion, but received none of the inheritance which was previously divided; he, however, received his portion of the inheritance which had not already been divided; but if the father to whom he was attributed had disowned him, he was not joined to the heirs. If he was a child of a slave-woman whom the father did not possess or of a free woman with whom he had illicit intercourse, he was not joined to the heirs and did not inherit even if the one to whom he was attributed is the one who claimed paternity, since he was a child of fornication whether his mother was free or a slave. (Using translation from Abū Dāʾūd 2265)
أن رَسُولَ اللَّهِ ﷺ «قَضَى أَنَّ كُلِّ مُسْتَلْحَقٍ اسْتُلْحِقَ بَعْدَ أَبِيهِ الَّذِي يُدْعَى لَهُ ادَّعَاهُ وَرَثَتُهُ بَعْدَهُ فَقَضَى إِنْ كَانَ مِنْ أَمَةٍ يَمْلِكُهَا يَوْمَ يَطَؤُهَا فَقَدْ لَحِقَ بِمَنِ اسْتَلْحَقَهُ وَلَيْسَ لَهُ فيمَّا قُسِمَ قَبْلَهُ مِنَ الْمِيرَاثِ شَيْءٌ وَمَا أَدْرَكَ مِنْ مِيرَاثٍ لَمْ يُقْسَمْ فَلَهُ نَصِيبُهُ وَلَا يَلْحَقُ إِذَا كَانَ الَّذِي يُدْعَى لَهُ أَنْكَرَهُ وَإِنْ كَانَ مِنْ أَمَةٍ لَا يَمْلِكُهَا أَوْ حُرَّةٍ عَاهَرَهَا فَإِنَّهُ لَا يَلْحَقُ وَلَا يَرِثُ وَإِنْ كَانَ الَّذِي يُدْعَى لَهُ هُوَ ادَّعَاهُ فهُوَ وَلَدُ زِنَا لِأَهْلِ أُمِّهِ مَنْ كَانُوا حُرَّةً أَوْ أَمَةً»