Living alone gives the opportunity to enjoy the company of others when that's what you want, but to be happily in solitude when that's your preference.
Being 'lonely' is less about actually feeling deprived of the company and others and much more about being unhappy about being with yourself.
People who are at peace with themselves are able to give out to others, and then to take up the drawbridge and enjoy their own company.
So many relationships exist where people stay together out of habit or fear of being alone. Not much happiness there.