A blessing in disguise is a blessing in disguise.
Everything has advantages and disadvantages. The meaning of this famous saying is that although you are hurt for a while, you may benefit from it. It also means that bad things can turn into good things under certain conditions.