“I heard the Messenger of Allah (ﷺ) say: ‘The (funeral) prayer should be offered for a child.’”
Sunan Ibn Majah Book 6, Hadith 75