While we were with the Messenger of Allah (ﷺ) in the cave, the rest of the hadith is the same as the one narrated above.
Sahih Muslim Book 39, Hadith 189