When debugging my program I keep getting these two errors: 

> 
> main.obj : error LNK2005: "class std::basic\_istream > & \_\_cdecl operator>>(class std::basic\_istream > &,class Complex &)" (??5@YAAAV?$basic\_istream@DU?$char\_traits@D@std@@@std@@AAV01@AAVComplex@@@Z) already defined in Imaginary.obj
> 
> 
> 1>main.obj : error LNK2005: "class std::basic\_ostream > & \_\_cdecl operator<<(class std::basic\_ostream > &,class Complex const &)" (??6@YAAAV?$basic\_ostream@DU?$char\_traits@D@std@@@std@@AAV01@ABVComplex@@@Z) already defined in Imaginary.obj
> 
> 
> 

I have tried restarting my project to make sure that I created a console application and not something else on accident but that didn't work. Any direction would be greatly appreciated. 

Here's my code:

imaginary.h

```
#ifndef imaginary_h_
#define imaginary_h_

#include <iostream>

class Complex
{    
    friend std::ostream & operator << (std::ostream& os, const Complex&);
    friend std::istream & operator >> (std::istream& is, Complex&);

private:    
    double real;
    double imag;
    char op;

public:    
    double r = real;
    double i = imag;
    char o = op;

    Complex()
    {    
    }

    Complex(double r, double i, char o)
    {    
    }

    bool userTest();    
};

#endif

std::ostream & operator << (std::ostream & os, const Complex & complex)    
{
    os << complex.r << complex.o << complex.i << "i" << "/n" << "/n";
    return os;
}

std::istream & operator >> (std::istream & is, Complex & complex)    
{
    is >> complex.r >> complex.o >> complex.i;
    return is;
}

```

Imaginary.cpp

```
#include "imaginary.h"    
#include <iostream>

bool Complex::userTest()

{
    if (op == '+' || op == '-')

    {
        return true;
    }

    else

    {
        std::cout << "Incorrect operand entry, please enter complex number as x+yi" << "/n" << "/n";

                return false;
    }

}

```

main.cpp

```
#include "imaginary.h"

#include <iostream>

int main()
{
    double userInput;

    std::cout << "Here you will add or subtract complex numbers." << "/n" << "/n";

    do

    {

        std::cout << "Please enter the real part of you complex number: " << "/n" << "/n";

                Complex complex;

        std::cin >> complex;

        std::cout << "/n" << "/n" << "/n/t" << "Note: Remember to enter your complex number in the format of x+yi to avoid an error";

                if (complex.userTest())
                {
                    std::cout << complex << "/n" << "/n";
                }

        std::cout << "Would you like to perform another complex number operation? " << "/n" << "/n/t";

                        std::cout << "Choose 1 for Yes and 2 for No" << "/n" << "/n";

        std::cin >> userInput;

    } while (userInput == 1);

    system("pause");

    return 0;
}

```