Almighty Allah narrated: And there entered with him two young men in the prison. One of them said: "Verily, I saw myself (in a dream) pressing wine." The other said: "Verily, I saw myself (in a dream) carrying bread on my head and birds were eating thereof" (They said): "Inform us of the interpretation of this. Verily, we think you are one of the Muhsineen (doers of good)."
He said: "No food will come to you (in wakefulness or in dream) as your provision, but I will inform (in wakefulness) its interpretation before it (the food) comes. This is of that which my Lord has taught me. Verily, I have abandoned the religion of a people that believe not in Allah and are disbelievers in the Hereafter. And I have followed the religion of my fathers, - Abraham, Isaac and Jacob and never could we attribute any partners whatsoever to Allah. This is from the Grace of Allah to us and to mankind, but most men thank not (i.e. they neither believe in Allah, nor worship Him).
"0 two companions of the prison! Are many different lords (gods) better or Allah, the One, the Irresistible? You do not worship besides Him but only names which you have named (forged), you and your fathers, for which Allah has sent down no authority. The command (or the judgment) is for none but Allah. He has commanded (i.e. His Monotheism), that is the (true) straight religion, but most men know not.
"0 two companions of the prison! As for one of you, he (as a servant) will pour out wine for his lord (King or master) to drink; and as for the other, he will be crucified and birds will eat from his head. Thus is the case judged concerning which you both did inquire."
And he said to the one whom he knew to be saved: 'Mention me to your lord (i.e. your King, so as to get me out of the prison)." But Satan made him forget to mention it to his lord or Satan made (Joseph) to forget the remembrance of his Lord (Allah) as to ask for His Help, instead of others. So (Joseph) stayed in prison a few (more) years. Surah 12: 36-42