model: Add use of "extern template" to prevent duplicate instantiation/initialization of templated classes

This syntax has been tested with gcc and clang, but may not be fully
supported by other compilers.  Additional testing (and optional ifdef
blocks) is required for the final solution to the problem.