idiom
fair-weather friend
Meaning
a person who is only your friend when things are good
Example
A **fair-weather friend** will leave you when things get tough.