Let me answer the question in this way:
Anything produced by sin is not inherently good. Death, illness, famine are not good things. They show us we live in a world that needs a Savior, even all creation groans for one (Romans 8:22-24).
However, good things can come out of bad situations.
Bringing back the example of Joseph, his brothers sold him into slavery (slavery, an effect of man’s sinful nature, is bad). The wife of one his of masters falsely accuses him of attempted rape (lying, is bad), and they throw Joseph into prison because of these false accusations (Genesis 39:19-21).
Nevertheless, God produces something good from this bad situation. Because of his reputation in the prison as a dream interpreter, Joseph interprets the Pharaoh’s dream about an impending famine, saves Egypt, and winds up second in command over Egypt (Genesis 41).
God doesn’t always provide a reason for our present suffering, and our friends and family members can often do more harm than good in terms of comforting us.
However, no matter what trial we’ve encountered, we can rest assured that God has everything under control. Satan only has so much power, and sometimes good can come out of enormous suffering.
Trust God, like Job had, and never give up in the face of great suffering. God is there, even when it doesn’t feel like that.