no sunlight could reach them during their sleep in the cave. one could see the rising sun decline to the right of their cave and the setting sun move its way to the left whilst they were sleeping in an opening of the cave. this is one of the miracles of god. whomever god guides receives the right guidance and you will never find a guardian or guide for those whom he causes to go astray.
وترى الشمس إذا طلعت تزاور عن كهفهم ذات اليمين وإذا غربت تقرضهم ذات الشمال وهم في فجوة منه ذلك من آيات الله من يهد الله فهو المهتد ومن يضلل فلن تجد له وليا مرشدا