Fair weather friend is a popular idiomatic expression, referring to a friend that cannot be relied on during hard times.
The phrase uses fair weather analogously to “good times” when no trouble or difficulty is afoot.
The exact origin of “fair weather friend” is not clear, however it appears as far back as the 17th century.
The expression comes from a sailing metaphor, where fair weather meant smooth sailing, without any difficulties; everyone can be called a reliable friend at those times as there aren’t any troubles for which friends need to be responsible for.
“Fair weather friend” has been and still is a popular expression for unreliable friends, appearing in various different context in the past several centuries.
While it is certainly archaic and outdated today, its idiomatic position makes sure that it won’t be forgotten for a while.