A friend is always a friend. By that we do not say that friendship is a timeless situation. In fact, we know by experience that some friendly relations sort of wane away after a while. Time does put friendships to the test. But, more than time, it is conditions and situations that really might check on friendships. What we say here is that friends are such particularly when they stay affectionate all along the most difficult times.
There are two ways to interpret the sentence about friends being recognizable in dire straits. The first is to consider a friend whoever does not desert us when ‘we’ are in troubles. The second is to recognize a friend when ‘he’ is himself in serious difficulties but keeps on offering his affection and closeness to us. Of course, it is also important when a friend in trouble seeks help from us. It means he trusts us. But this situation is very difficult to distinguish and to separate from acts of desperations and convenience.
Having said that, it is not unlikely that two individuals who know each other do fall together in disgrace, simultaneously. In such a situation if one of the two friends keeps supporting the other (notwithstanding the availability of other easier options), he is certainly doing something special. Indeed, he is helping someone in dire straits when he is himself in dire straits. In short, if both fall in disgrace and both help each other, we are in front of one among the highest examples of friendship.