Stroking the head of an orphan and honouring him is recommended.
After the martyrdom of Ja’far (may Allah be pleased with him), the Messenger of Allah ﷺ picked up his son Abdullah, stroked his head three times, and each time he stroked it he said:
اللهم اخلف جعفرا فى ولده
“O Allah! Be his successor among Ja’far’s children.”
Reference: Hasan (good): Ahkam al-Janaiz: p. 212, Ahmad: 1760, Hakim: 1/372, Bayhaqi: 4/60