Valmiki Ramayana Yuddha Kanda Sarga 63 Shloka 27
Original Shlokaस सुहृद्योविपन्नार्थंदीनमभ्यवपद्यते ।।6.63.27।। स बन्धुर्योऽपनीतेषुसाहाय्यायोपकल्पते ।
1 source checked for this shloka
यः he who, विपन्नार्थम् fortune at loss, दीनम् desperate, अभ्यवपद्यते, सः he, सुहृत् out of love, यः he, अपनीतेषु deviating from morals, साहाय्याय one who helps, उपकल्पते prepared, सः he, बन्धुः is a relation.
" A friend is one who helps when one's fortune is lost and is desperate. Deviating from morals the one who is prepared to help is a relation."