Sunan Ibn Majah, Book 9, Hadith 161 (Ibn Majah 2005)

It was narrated from 'Umar that:

the Messenger of Allah ruled that the child belonged to the bed.