All of the philosophers agree that friendship is one of the most prized goods that a man can possess. St. Thomas Aquinas, in commenting on a passage of Aristotle, says that "no one in his right mind would choose to live in the possession of great external goods without friends." (Commentary on the Ethics, Book 8).
Now what exactly is friendship? In the Summa Theologica, when speaking of the virtue of charity, St. Thomas writes:
not every love has the character of friendship, but that love which is together with benevolence, when, to wit, we love someone so as to wish good to him...Yet neither does well-wishing suffice for friendship, for a certain mutual love is requisite, since friendship is between friend and friend: and this well-wishing is founded on some kind of communication. (2nd pt. of 2nd pt., q. 23, a. 1).
Thus, friendship has three essential qualities: 1) that the lover love his beloved with the love of benevolence, by which he desires the good for that other person; 2) that this love be shared and mutual between the two people - thus, they must both love each other with that love of benevolence; and 3) that there be an actual communication of this love between them - e.g. by words and deeds, by the presence of the lovers to one another, by a common working for the good of each other, etc.
Friendship, as described here, is held to be quite necessary to the well-being of man; for as St. Thomas says, no man in his right mind would choose to live without friendship, even if he was in possession of many other good things. But when this matter is brought into the context of the spiritual life, there is a further clarification which must be made.
First, it should be noted that often, in the spiritual life, God afflicts a man with certain trials, tribulations, and sufferings. One of these sufferings - perhaps one of the most difficult to bear - consists in being deprived of the friendship of other men, i.e. loneliness. Now it is well to remember that this is given to us from God, for the sake of our purification and edification on the road to sanctity. Hence, it is our duty to embrace these sufferings as the Will of God. But surely, this contradicts what St. Thomas says, namely that no man in his right mind would choose to live without friendship? After all, one would think that a man would be in his "right mind" to embrace the sufferings that God sends him; but in so doing, how could he not be also choosing to live without the good of friendship with other men? Can he both be and not be in his "right mind" at the same time? - in his right mind in the sense of accepting God's Will, but not in his right mind in the sense of choosing to live without friendship? How is this apparent contradiction to be resolved?
Here we come to the crucial point, the all-important distinction between friendship with man, and friendship with God. It is immensely important that, whereas sometimes we may be rightly deprived of the love of other men, and thus of their friendship, we are never deprived of God's Love for us, and we absolutely must always seek friendship with Him. We can be absolutely certain that a man would not be in his right mind if he were to choose to live without the friendship of God, without charity.
As for human friendships, it is possible, and often it is actually the case, that a man is in his right mind to choose to live without such friendships; but this is only because he sacrifices these friendships for the sake of his having friendship with God, assuming that this is what God demands of him. Indeed, when God deprives us of friends, when we suffer from loneliness, this is precisely what God is demanding of us: that we make a sacrifice, and accept His holy Will, out of love for Him, and a desire for His friendship. (This sacrifice having been made, God may decide, in due time, to return to us the goods of friendship; but so long as He does not do so, we must accept our loneliness.) Thus, it is only because we choose to live with God's friendship that our choice to live without human friendship can be made in our "right mind." St. Thomas' words, then, need not be understood to refer exclusively to human friendships, but at least to friendship in general; in the context of the spiritual life, the principle may be understood to refer to friendship with God.
Ultimately, once we have achieved the perfection of friendship with God, we may not even feel the need for human friendship. Our loneliness will no longer cast us down any further, for we will have risen above it; we will have discovered an Eternal Good which suffices for all the temporal goods which we do not possess. Having reached such a state, we will be in the rightest of minds.