The Messenger of Allah ﷺ said, "Three are given their reward twice. A man who has a slave-girl whom he teaches well, disciplines well, then frees and marries, he receives two rewards. A believer from the People of the Book who believed previously and then believed in the Prophet ﷺ, he receives two rewards. And a slave who fulfills the right of Allah and is sincere to his master."Then Shaybi said, "I have given this hadith to you without charge, though a man used to travel all the way to Madinah for something less than this."
أن رسول الله ﷺ قال: ثلاثة يؤتون أجرهم مرتين: الرجل تكون له الأمة فيعلمها فيحسن تعليمها، ويؤدبها فيحسن أدبها، ثم يعتقها فيتزوجها فله أجران ومؤمن أهل الكتاب الذي كان مؤمنا ثم آمن بالنبي ﷺ الله فله أجران، والعبد يؤدي حق الله وينصح لسيده. ثم قال الشعبي: وأعطيتكها بغير شيء، وقد كان الرجل يرحل في أهون منها إلى المدينة.
Bukhari narrated it in the Book of Jihad (3011), and Muslim in the Book of Faith (154), both from the hadith of Sufyan bin Uyayna, who said, Salih bin Huyayy Abu Hasan told us, he said, I heard Shaybi say, Abu Burda told me that he heard his father narrate from the Prophet ﷺ, and he related something similar. The wording given is that of Bukhari, and the wording of Muslim is close to it, and it contains, "And a man who had a slave woman, and he raised her well and educated her well, and disciplined her well..."Then Shaybi said to the Khurasani man who had asked him about it, "Take this hadith without paying anything for it, for a man used to travel for less than this all the way to Madinah."Salih bin Huyayy is Salih bin Salih bin Huyayy, named after his grandfather. It is also said that he is Salih bin Salih bin Muslim bin Huyayy, in which case his lineage would trace back to his father's grandfather.