I heard Messenger of Allah ﷺ 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.
سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ انْطَلَقَ ثَلاَثَةُ رَهْطٍ مِمَّنْ كَانَ قَبْلَكُمْ حَتَّى آوَاهُمُ الْمَبِيتُ إِلَى غَارٍ وَاقْتَصَّ الْحَدِيثَ بِمَعْنَى حَدِيثِ نَافِعٍ عَنِ ابْنِ عُمَرَ غَيْرَ أَنَّهُ قَالَ قَالَ رَجُلٌ مِنْهُمُ اللَّهُمَّ كَانَ لِي أَبَوَانِ شَيْخَانِ كَبِيرَانِ فَكُنْتُ لاَ أَغْبُقُ قَبْلَهُمَا أَهْلاً وَلاَ مَالاً وَقَالَ فَامْتَنَعَتْ مِنِّي حَتَّى أَلَمَّتْ بِهَا سَنَةٌ مِنَ السِّنِينَ فَجَاءَتْنِي فَأَعْطَيْتُهَا عِشْرِينَ وَمِائَةَ دِينَارٍ وَقَالَ فَثَمَّرْتُ أَجْرَهُ حَتَّى كَثُرَتْ مِنْهُ الأَمْوَالُ فَارْتَعَجَتْ وَقَالَ فَخَرَجُوا مِنَ الْغَارِ يَمْشُونَ