istream error

So I've made this program for my class, but I keep getting the same error, any help would be much appreciated.
Here is the code in complexx.h
class complex
{
public:
complex(double x = 0.0, double y = 0.0);
double magnitutde() const;
double realPart() const;
double imagPart() const;

complex& operator+ (const complex& rhs);
complex& operator/ (const complex& rhs);
complex& operator- () const;
friend complex operator-(const complex& lhs, const complex& rhs);
friend bool operator==(const complex& lhs, const complex& rhs);
friend istream& operator>>(istream& istr, complex& x);

private:
double real;
double imag;
};


The error is
In file included from complex.cpp:3:0:
complexx.h:14:10: error: ‘istream’ does not name a type

any ideas?
std::istream
Have you included
1
2
#include<iostream>
using namespace std;

into your code?
The error I get with std::istream is
‘istream’ in namespace ‘std’ does not name a type

However when I included
#include<iostream>
using namespace std;
it worked, if I did it with std::istream instead would I still need #include <iostream>?
if I did it with std::istream instead would I still need #include <iostream>?


Yes, you need to include iostream no matter what, because that is where istream is defined.

Although if you type out std::istream, you do not need the using namespace std; line.
so what is std then?
Topic archived. No new replies allowed.