a fair-weather friend
Someone who remains a friend only when things are going well but abandons others during times of trouble or difficulty. I thought Allison and I had a strong friendship, but I learned she was just another fair-weather friend when she stopped talking to me after my divorce.
a fair-weather friendsomeone who cannot be relied on in a crisis.
1998 Spectator The Americans gave up supplying gold on demand to other countries' central banks at £35 an ounce…when their fair-weather friends from London threatened to turn up and clean them out.