Ha-ha, very funny but very instructive bug; thank you for asking this question.
To sort it out, do the following: replace
std::string& bridge(A a)
with
std::string& bridge(A& a)
Do I even have to explain what's going on? I hope now you can figure it out by yourself. :-)
—SA