Sure Al-Kahf

18:82

وَأَمَّا ٱلْجِدَارُ فَكَانَ لِغُلَٰمَيْنِ يَتِيمَيْنِ فِى ٱلْمَدِينَةِ وَكَانَ تَحْتَهُۥ كَنزٌۭ لَّهُمَا وَكَانَ أَبُوهُمَا صَٰلِحًۭا فَأَرَادَ رَبُّكَ أَن يَبْلُغَآ أَشُدَّهُمَا وَيَسْتَخْرِجَا كَنزَهُمَا رَحْمَةًۭ مِّن رَّبِّكَ ۚ وَمَا فَعَلْتُهُۥ عَنْ أَمْرِى ۚ ذَٰلِكَ تَأْوِيلُ مَا لَمْ تَسْطِع عَّلَيْهِ صَبْرًۭا

Was aber die Mauer angeht, so gehörte sie zwei Waisenjungen in der Stadt, und unter ihr befand sich ein für sie bestimmter Schatz. Ihr Vater war rechtschaffen, und da wollte dein Herr, daß sie (erst) ihre Vollreife erlangen und (dann) ihren Schatz hervorholen - aus Barmherzigkeit von deinem Herrn. Ich tat es ja nicht aus eigenem Ermessen. Das ist die Deutung dessen, was du nicht aushalten konntest."

Tafsir 18:82

As for the wall which I fixed but you criticised me for fixing, it belonged to two young boys in the town we went to and whose father had passed away. Beneath the wall some wealth of theirs was buried. And the father of these two boys was pious. So your Lord intended, O Moses, that they reach the age of discerning and grow up, and take out their wealth which was buried underneath it, because if the wall were to fall now, their wealth would become exposed and go to waste. And this plan was your Lord’s mercy on them. And I did not do this of my own judgment. This is the explanation of what you were unable to bear”.