I’ve looked into this, and the answer is the same for any developing country: if you can produce a judiciary, police force, and military that will enforce property rights, moral (reciprocal) contracts, and where bureaucrats are open to suit by anyone for corruption, then eventually you will prosper.
Nigeria and Ghana at the very least have nothing but time holding them from becoming an advanced society. There are, in both countries, upper middle class (professionals), and those people are the ones who matter.