Joseph thought that the cup-bearer's dream was his best way to get out of prison, but God had a greater plan. He let Joseph to be forgotten in prison for two years because He had a greater plan for him. 😁 Greater things really take time.
So Joseph spent two years in prison to be trained and equipped by God. There, he served the prisoners and the jail guards. What you think is a prison is actually a waiting place or a training ground.
However, Joseph wanted only to get out of the prison but God prepared a door for him not just as a way out but also as an entrance to the palace. God used Pharaoh's problem to be that door.
So it wasn't really the cup-bearer's success but Pharaoh's problem that got Joseph out of the prison and put him in the palace.
Isn't it amazing that God uses other's problems like a door to your success?