[ad_1]
When you do
writeSite(body.str(), "application/json");
the string object returned by body.str() is temporary. And non-constant references can not bind to temporary objects.
A simple solution is to make the site argument const just like you have done for the contentType argument (which would otherwise suffer from the same problem).
[ad_2]
solved No matching function call for ostringstream `.str()`