I define friendship to be the reciprocated relationship between two people who love one another. This statement is deceptively simple, but I have spent many years struggling to make it meaningful to me. There are two links:
a definition of friendship (short) and
a definition of love (long). Note that the term "love" does not refer to romance, except incidentally.
So the answer to your question, mystifying as it may seem, is to love others, and to love yourself, so that others are willing to love you. Embedded into this is a lot of subtext and complexity that I've tried my best to explain, but suspect I have a long way to go.