Hadithcore
Hadith #2111770

Narrated 'Abdullah bin 'Umar (RA):

Allah's Messenger (ﷺ) said: "The right to inheritance from a freed slave is a relationship like the relationship of blood relatives (lineage); it cannot be sold or given away." [al-Hakim reported it through ash-Shafi'i's narration from Muhammad bin al-Hasan on the authority of Abu Yusuf. Ibn Hibban graded it Sahih (authentic), while al-Baihaqi graded it defective].

وَعَنْ عَبْدِ اَللَّهِ بْنِ عُمَرَ ‏- رَضِيَ اَللَّهُ عَنْهُمَا‏- قَالَ : قَالَ اَلنَّبِيُّ ‏- صلى الله عليه وسلم ‏-{ اَلْوَلَاءُ لُحْمَةٌ كَلُحْمَةِ اَلنَّسَبِ , لَا يُبَاعُ , وَلَا يُوهَبُ } رَوَاهُ اَلْحَاكِمُ : مِنْ طَرِيقِ اَلشَّافِعِيِّ , عَنْ مُحَمَّدِ بْنِ اَلْحَسَنِ , عَنْ أَبِي يُوسُفَ ، وَصَحَّحَهُ اِبْنُ حِبَّانَ , وَأَعَلَّهُ اَلْبَيْهَقِيُّ [1]‏ .‏

References2 variants
Sunnah.com reference
Book 7, Hadith 220
Arabic/English book reference
Book 7, Hadith 963