cin and cout not working (invalid operand to binary expression)

I am working in CLion, just installed today and fresh. All default settings.

This works fine:

#include <iostream>
using namespace std

int main () {
cout << "Hello world";
return 0;
}


However this does not work:

#include <iostream>
using namespace std

int main () {
string word = "Hello World";
cout << word;
return 0;
}


What I was originally trying to do was this:

#include <iostream>
using namespace std

int main () {
string word;
cin >> word;
return 0;
}

But basically the << or >> is highlighted and it says "invalid operand to binary expression (std::ostream(AKA basic_ostream<char>) and std::string)"
This makes no sense to me, since nothing is a char and shouldn't I be able to use the << operator to add chars to strings anyway? Any ideas of what might be wrong is much appreciated.
#include <string>
Topic archived. No new replies allowed.