A friend who supports others only when it is easy and convenient to do so: “I thought Gene would always stick by me, but when I got into trouble, he turned out to be a fair-weather friend.”
fair-weather friend
A person who is dependable in good times but is not in times of trouble. For example, You can't rely on Sarah
she's strictly a fair-weather friend. This expression likens fair weather to good times. [Early 1700s]