It is also a property of friendship that one take delight in a friend’s presence, rejoice in his words and deeds, and find in him security against all anxieties; and so it is especially in our sorrows that we hasten to our friends for consolation. Since, then, the Holy Spirit constitutes us God's friends, and makes Him dwell in us, and us dwell in Him (as was shown), it follows that through the Holy Spirit we have joy in God and security against all the world’s adversities and assaults.
Thomas Aquinas, Summa Contra Gentiles, Book IV, Chapter 22, Section 3.