A plan for Western countries to help fund South Africa’s transition from coal was difficult to reach, but parties announced an agreement Friday. It could be a model for other countries.