C++ Ambiguous overload in operator>> for complex class
I am constantly getting an ambiguous overload error no matter what I do ....
here's my code

**COMPLEX.cpp code**

    template<class C> class complex
    {  
        C real,imag;
	
	    public:
	
	    //constructors
	    complex(C real=0,C imag=0)
	    {
		    complex::real=real;
		    complex::imag=imag;
	    }
	
	    complex(const complex& cmplx)
	    {
		    real=cmplx.real;
		    imag=cmplx.imag;
	    }
	
	    //functions available
	    complex<C> operator+(const complex&);
	    complex<C> operator+(double);
	    void operator=(const complex&);
		
	    //friend functions available
	    template<class F> friend complex<F> operator+(double,const complex<F>&);
	    template<class F> friend istream& operator>>(istream&,const complex<F>&);
	    template<class F> friend ostream& operator<<(ostream&,const complex<F>&);
     };

**OPERATOR>> implementation**

    template<class F> istream& operator>>(istream& cin,const complex<F>& cmplx)
    {
	    cout<<"\nenter real part followed by imaginary part : ";
	    
	    cin>>cmplx.real>>cmplx.imag;
	    
	    return cin;
    }

**MAIN method**

    int main(void)
    {
	    complex<int> C1;
	    complex<int> C2;
	    complex<int> C3;
	    
	    cin>>C1>>C2>>C3;
	
	    cout<<C1<<C2<<C3;
	
	    C1=C1+3;
	    C2=2+C2;
	    C3=C1+C2;
	    
	    cout<<C1<<C2<<C3;
	    
	    complex<int> C4(C3);
	    
	    cout<<C4;
	    
	    return 0;	
    }

**COMPILER ERROR**

    COMPLEX.cpp: In function ‘std::istream& operator>>(std::istream&, const complex<C>&) [with F = int, std::istream = std::basic_istream<char>]’:
    
    COMPLEX.cpp:91:7:   instantiated from here
    
    COMPLEX.cpp:75:2: error: ambiguous overload for ‘operator>>’ in ‘cin >> cmplx.complex<int>::real’
    
    COMPLEX.cpp:75:2: note: candidates are:
    /usr/include/c++/4.6/istream:122:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>

    /usr/include/c++/4.6/istream:122:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}’

    /usr/include/c++/4.6/istream:126:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>, std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match>

    /usr/include/c++/4.6/istream:126:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}’

    /usr/include/c++/4.6/istream:133:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>

    /usr/include/c++/4.6/istream:133:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::ios_base& (*)(std::ios_base&)’

    /usr/include/c++/4.6/istream:241:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match>

    /usr/include/c++/4.6/istream:241:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}’

before this I wrote a MATRIX.cpp and istream overload works fine there even though its nearly the same as here....
C++ Ambiguous overload in operator>> for complex class
===

I am constantly getting an ambiguous overload error no matter what I do ....
here's my code

**COMPLEX.cpp code**

    template<class C> class complex
    {  
        C real,imag;
	
	    public:
	
	    //constructors
	    complex(C real=0,C imag=0)
	    {
		    complex::real=real;
		    complex::imag=imag;
	    }
	
	    complex(const complex& cmplx)
	    {
		    real=cmplx.real;
		    imag=cmplx.imag;
	    }
	
	    //functions available
	    complex<C> operator+(const complex&);
	    complex<C> operator+(double);
	    void operator=(const complex&);
		
	    //friend functions available
	    template<class F> friend complex<F> operator+(double,const complex<F>&);
	    template<class F> friend istream& operator>>(istream&,const complex<F>&);
	    template<class F> friend ostream& operator<<(ostream&,const complex<F>&);
     };

**OPERATOR>> implementation**

    template<class F> istream& operator>>(istream& cin,const complex<F>& cmplx)
    {
	    cout<<"\nenter real part followed by imaginary part : ";
	    
	    cin>>cmplx.real>>cmplx.imag;
	    
	    return cin;
    }

**MAIN method**

    int main(void)
    {
	    complex<int> C1;
	    complex<int> C2;
	    complex<int> C3;
	    
	    cin>>C1>>C2>>C3;
	
	    cout<<C1<<C2<<C3;
	
	    C1=C1+3;
	    C2=2+C2;
	    C3=C1+C2;
	    
	    cout<<C1<<C2<<C3;
	    
	    complex<int> C4(C3);
	    
	    cout<<C4;
	    
	    return 0;	
    }

**COMPILER ERROR**

    COMPLEX.cpp: In function ‘std::istream& operator>>(std::istream&, const complex<C>&) [with F = int, std::istream = std::basic_istream<char>]’:
    
    COMPLEX.cpp:91:7:   instantiated from here
    
    COMPLEX.cpp:75:2: error: ambiguous overload for ‘operator>>’ in ‘cin >> cmplx.complex<int>::real’
    
    COMPLEX.cpp:75:2: note: candidates are:
    /usr/include/c++/4.6/istream:122:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>

    /usr/include/c++/4.6/istream:122:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}’

    /usr/include/c++/4.6/istream:126:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>, std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match>

    /usr/include/c++/4.6/istream:126:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}’

    /usr/include/c++/4.6/istream:133:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>

    /usr/include/c++/4.6/istream:133:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::ios_base& (*)(std::ios_base&)’

    /usr/include/c++/4.6/istream:241:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match>

    /usr/include/c++/4.6/istream:241:7: note:   no known conversion for argument 1 from ‘const int’ to ‘std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}’

before this I wrote a MATRIX.cpp and istream overload works fine there even though its nearly the same as here....