std::cout << "In foo\n";
std::cout << "In bar - cheers!\n";
};//end of class A
$ g++ foo.cpp
In bar - cheers!
Either you didn't try this simple test, or your attempt to paraphrase the problem completely missed out the real problem you're having.