I think that implementing a routing protocol would solve the problem. I mean, if there is no possible way for C to see A, with the routing protocol he will find the path that leads to A through B. It could be implemented by creating a kind of routing table in each ESP, loaded with the IP direction of its neighborgs, so if you want to know how to reach a certain device that is out of range, you're gonna need to check the routings tables of your neighborgs to see if they know it. If it is, you take the IP and the path that leads to it (IP of B, in this case); if it don't, you will check the neighbors of the neighbors until he finds what he's looking for. I think that this implementation could solve the problem, but I dont know really. If you wanna try it, do it and then let me know what happens!
Regards,
Angelo CrIncoli