Starting with sth's answer to this question:
I was wondering how to resolve multiple definition errors if the following code is put in a header file included multiple times by different .cc files and linked together:
template <typename T>
class C {
   static const int K;
   static ostream& print(ostream& os, const T& t) { return os << t;}
};
// general case
template <typename T>
const int C<T>::K = 1;
// specialization
template <>
const int C<int>::K = 2;