If a man leaves behind a benefactor or a person upon whom he has bestowed favors and has no other heir, the wealth belongs to that individual. However, if he leaves behind multiple benefactors or those upon whom favors were bestowed, both men and women, the wealth is to be divided among them, with the male receiving the share equal to that of two females.
If he leaves behind the sons and daughters of his benefactor or the one upon whom he bestowed favors, and there is no other heir, the wealth belongs to the sons and daughters of his benefactor, with the male receiving the share equal to that of two females. This is because the bond of loyalty (wala') is like the bond of kinship.
However, if he leaves behind an heir from his blood relatives, whether closely or distantly related, along with his benefactor or the one upon whom he bestowed favors, the wealth belongs to the blood relative, and the benefactor receives nothing.
This is because Allah
سبحانه وتعالى, the Mighty and Majestic, says:
"Those who are related by blood are more entitled to inherit from each other in the Book of Allah
سبحانه وتعالى than the believers and the emigrants, except that you do kindness to your allies,"
(Surah Al-Ahzab
33:6),
This meaning through a will for them or by the heirs gifting them something from the inheritance.