While in prison, Joseph was placed in charge of two new prisoners: Pharaoh's Chief Cupbearer and Chief Baker. In time, both had a troubling dream; and, God enabled Joseph to interpret their dreams. As interpreted, the Chief Cupbearer was restored to his former position. The Chief Baker was executed. Although, Joseph had requested that his case be revealed to the Pharaoh, the Chief Cupbearer forgot about Joseph. But, God was in control and events were proceeding according to His Will.
Reference: Genesis 40:1-23