The Qur'an says...
The Qur'an says: "(My Lord) knows the ghayb and He does not expose His ghayb to anyone except to one with whom He is pleased from the messenger..." (72:26-27) "...And Allah is not about to inform you about the ghayb, but Allah chooses from His messengers whomsoever He pleases [for the ghayb]." (3:179) "He knows what is before them and what is behind them, and they cannot comprehend anything of His knowledge except what He pleases." (2:255) The import of these verses is that Allah bestows 'ilmu 'l-ghayb to some created beings.
When you put all the verses about the knowledge of the unseen together, you get the overall conclusion that (1) Allah is the only original and independent possesser of 'ilumu 'l-ghayb, and that (2) whosoever from the angels, prophets, messengers, Imams and other virtuous persons that have 'ilmu 'l-ghayb is totally dependent on Allah's discretion and power.[^1] After commenting on the last verses of surah 72, 'Allamah at-Tabataba'í reaches the following conclusion: "The exclusive possession of the 'ilmu 'l-ghayb by Almighty Allah is in the sense of originality that we have explained, and so He, the Almighty, knows the ghayb by Himself while the others know the ghayb by Him informing them about it.
And so it becomes clear that what has been mentioned in His words about others not having the 'ilmu 'l-ghayb actually means 'not having it by themselves and independently,' it does not deny what others know [of the ghayb] through revelation..."[^2] 'Ilmu 'l-Ghayb of the Prophets The Qur'an not only talks about the possibility of others having access to the 'ilmu 'l-ghayb, it actually gives various examples of those who had been given the 'ilmu 'l-ghayb by Almighty Allah. 1.
While counting the miraclous powers that he possessed, Prophet 'Isa (a.s.) says: "I will inform you of what you are eating and what you store in your houses..." (3:48) 2.
In reference to Prophet Yusuf, we have the following verses: "And thus does your Lord choose you and teaches you the interpretation of words." ( 12:6 , 12:21 ) "...And when they agreed to put him into the bottom of the pit, We revealed to him that (a time shall come when) you will inform them of this affair of theirs..." (12:15) "...I shall inform you two of its interpretation before comes to you (the food): this is from what my Lord has taught me..." (12:37) 3.
Prophet Sulayman were taught the language of the birds: "And Sulayman...he said, 'O men!