This tells the compiler to expect the template instance to be defined elsewhere. This is an extension of the use of the keyword ' extern '. In other words, the scope of the member functions of both class instances includes any file with the Jgx switch. The identifiers 'version1' and 'version2' are simply placeholders. They are necessary for the syntax of 'typedef' but do nothing and are not used.
Templates can simplify the work of a programmer but only at a price.
Much has been skipped. Specifically, there are a number of issues related to friends and class templates as well as static members of class templates. You should consult other books and your manual for more information. How to Program by H.M. Deitel and P.J. Deitel provides a brief but good introduction to these two topics.