Rafi bin Sinan reported,

Rafi accepted Islam, but his wife refused to do so. She came to the Prophet ﷺ and said, "My daughter, who is just weaned," or something similar.Rafi said, "She is my daughter."The Prophet ﷺ said to him, "Sit on one side."Then he said to her, "Sit on the other side."He placed the little girl between them and said, "Call her."The girl leaned toward her mother. The Prophet ﷺ said, "O Allah, guide her." The girl then turned toward her father, and he took her.

Azami 6585

Sahih

عن رافع بن سنان

أنه أسلم، وأبت امرأته أن تسلم، فأتت النبي ﷺ فقالت: ابنتي وهي فطيم، أو شبهه، وقال رافع: ابنتي. فقال له النبي ﷺ: اقعد ناحية وقال لها: اقعدي ناحية وأقعد الصبية بينهما، ثم قال: ادعواها فمالت الصبية إلى أمها. فقال النبي ﷺ: اللهم اهدها فمالت إلى أبيها فأخذها.

الأعظمي 6585صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Divorce
Section
If one of the parents becomes Muslim, with whom does the child stay
Numbering
Jami al-Kamil 6585 (2nd edition)
Azami 6585