It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) passed by a completely isolated (or orphaned child's) grave, so the Prophet (peace and blessings be upon him) led the people in prayer, and the people formed rows behind him, and he offered its (funeral) prayer.