(2) باب قِصَّةِ أَصْحَابِ الْغَارِ الثَّلاَثَةِ وَالتَّوَسُّلِ بِصَالِحِ الأَعْمَالِ
Abdullah b 'Umar reported:
I heard Allah's Messenger (ﷺ) as saying: Three persons belonging to the earlier Ummahs set out on a journey until they had to spend a night in a cave. The rest of the hadith is the same and the additional words are:" A person amongst them said: O Allah, I had my aged parents and I served them milk before I (served that) to my wife, children and my servants." And in case of the second one, the words are: "She avoided me until she was hard pressed because of famine and she came to me and I gave her one hundred and twenty dinars." And in case of the third one (the words are):" I invested his wages, and it brought profit and, as a result thereof, the merchandise increased and there was an abundance of goods." And he (the narrator said) that they got out of the cave and began to walk.
Reference: Sahih Muslim 2743 c
In-book reference: Book 49, Hadith 15
USC-MSA web (English) reference(deprecated numbering scheme): Book 36, Hadith 6609