Lol this is a long post. I'm probably just restating the obvious in a long and convoluted way, but here goes.
I guess for me, a real/close friend is someone you consider part of your "true family". And when I say true family, I don't necessarily mean biological family. The two are related but different words. True family is kind of hard to define. Your true family is the people you consider to be your allies. These people feel that the shit in your life is also their shit, and vice versa. To them, your shit is "our" shit. And to you, their happiness is "our" happiness and vice versa. These people are your "bros," and you consider them to be on your side. In your mind, they fit into the category of "us," not "them." You would protect them and do everything for them, even if you suffer for it. If you go down, then they would choose to go down with you, and vice versa. To an extent, you are able to forgive people in your true family if they hurt/betray you. Importantly, you feel that these people are the same as you.
I think this concept of true family is a fundamental mechanism in the human mind, and the cause of many aspects of human nature. For example, patriotism can be described as when the people in your nation are a part of your true family, bound together by the fact that you are all citizens who share the country's fate.
When you are born, your biological family starts off as part of your true family, but they may cease to be a part of your true family depending on the circumstances as your life goes on. And people who are not part of your biological family may become a part of your true family, for example spouses or close friends.
I think people in history who are known for their kindness to others, like Jesus Christ, often view the whole world as their true family. In their minds, everyone is the same as them because all people in the world are just people, struggling to deal with the shit in this world.
There are many nuances to this idea of true family. I tried my best to describe what I believe it is like, but I may be inaccurate, wrong, idealistic or naive. So yeah, that's basically it.