A man from the Ansar had a guest spend the night with him, and he had nothing except enough food for himself and his children. He said to his wife, "Put the children to sleep, extinguish the lamp, and bring out for the guest whatever you have." Then this verse was revealed, "They give preference over themselves, even though they are in need" [Hashr 59:9].This hadith is hasan sahih.
حدثنا أبو كريب حدثنا وكيع عن فضيل بن غزوان عن أبي حازم
أن رجلا من الأنصار بات به ضيف فلم يكن عنده إلا قوته وقوت صبيانه فقال لامرأته نومي الصبية وأطفئي السراج وقربي للضيف ما عندك فنزلت هذه الآية {ويؤثرون على أنفسهم ولو كان بهم خصاصة} هذا حديث حسن صحيح
Agreed upon [by Bukhari and Muslim]. Muslim also narrated it in the book on Drinks, chapter on honoring the guest and the merit of favoring him, hadith no. 2054, from Abu Kurayb. Bukhari narrated it, hadith no. 3798, from the hadith of Fudayl through the same chain.