A friend in need could be someone in trouble who needs your help and indeed becomes your friend in order to get it.
But the phrase is usually interpreted as meaning a friend who stands with you during a difficult time.
But if you accept that “in deed” is two words instead of one, it extends the definition of a good friend from one who stands with you to one who actually helps solve the problem.