2Why is it there? It is not part of the class so it must be declared outside of the class declaration (i.e. after the closing }; ). There are many different sorts of “helper” free functions that are not part of the class but are closely associated with it, and which must appear in the same namespace. It is a common convention to declare these functions in the same header file as the class.