Sahih Muslim Book 23, Hadith Number 5051.

Chapter : What should the guest do if an uninvited person accompanies him and the merit of inviting that person to feast.

Abu Mas’ud Ansari reported that a person from the Ansar who was called Abu Shu’aib had a slave who was a butcher (by profession). He (Abu Mas’ud) saw Allah’s Messenger (may peace be upon him) and found signs of hunger on his face. He said to the servant: 0 ye, prepare for us food sufficient for five persons, for I intend to invite Allah’s Apostle (may peace be upon him) who would be the fifth amongst the five. He (the narrator) reported that he then prepared the food and came to Allah’s Apostle (may peace be upon him) and invited all the five (including him) who was the fifth amongst them to the feast. A man followed him and when Allah’s Apostle (may peace be upon him) reached the door, he said: This man has followed us; if you like you may permit him (to join the meal) and if you like he can go back. Thereupon the person said: Allah’s Messenger, I permit him.