Unexpected error?!

Hello everyone,i wrote the following code where there is a function which ads two object of class type.In order to have acess in the private members of the class objects i declared my function as "friend".I try to compile it in visual studio 2006 but i have this "fatal error C1001: INTERNAL COMPILER ERROR".I tested in g++ in Ubuntu and it runs just fine! Does anyone knows what is going on?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
using namespace std;

class one
{
    public:
        one(){};
        one(int k,int l){a=k;b=l;}
        void print(){int w=a;int e=b;cout<<"a is "<<w<<",b is "<<e<<endl;}

    private:
        int a,b;
        friend one operator+(const one ena,const one dyo);     
};

one operator+(const one ena,const one dyo)
{

    return one((ena.a+dyo.a),(ena.b+dyo.b));
}


int main()
{
    one n1,n2(2,2),n3(7,3);
    n1=n2+n3;
    n1.print();

    
    
    return 0;
}


note:The compile error starts only when i declare my overload operator + as friend.Thanks!
An ICE just means that there is a serious bug in the compiler. It doesn't imply that your code is incorrect.
My operating system is windows 7, do you think i have this erroe becuase vs6 is too old??
There is a big difference between Visual Studio 2006 (does it even exist?) and Visual C++ 6.0 and yes, it's definitely too old.
That doesn't have anything to do with the operating system, though.
Topic archived. No new replies allowed.