First of all, this code does compile with g++ 3.3.5. But with g++ 4.0.2 it gives me a few errors. g++ enters the #else portion. The _MSC_VER is meant to be able to compile it in VC++ 5

Code:
#ifdef _MSC_VER
        friend CMatriz<TG> operator+(const TG &op1,const CMatriz<TG> op2); // objeto TG + CMatriz
        friend CMatriz<TG> operator+(const double &op1,const CMatriz<TG> &op2); // constante + CMatriz
#else /*Next line is 64*/
        friend CMatriz<TG> operator+ <>(const TG &op1,const CMatriz<TG> &op2); // objeto TG + CMatriz
        friend CMatriz<TG> operator+ <>(const double &op1,const CMatriz<TG> &op2); // constante + CMatriz
#endif
The compiler says:
Matriz.h:64: error: declaration of 'operator+' as non-function
This error happens too with another operators. However with the <<:

Code:
#ifdef _MSC_VER
        friend ostream &operator<<(ostream &os,const CMatriz<TG> &op);
#else /*Next line is 87*/
        friend ostream &operator<< <>(ostream &os,const CMatriz<TG> &op);
#endif
The compiler gives a different error:
Matriz.h:87: error: template-id 'operator<< <>' for std::basic_ostream<char, std::char_traits<char> >& operator<<(std::basic_ostream<char, std::char_traits<char> >&, const CMatriz<CComplejo>&)' does not match any template declaration

Any clues as to how should these be declared?