A base C++ class to provide reference counting