Because endl is defined within the namespace std. This means to the compiler, endl and std::endl are completely different things. Basically, all standard library things need to be prefixed with std:: because they often have names that you might want to use for your own functions (such as begin and end) and the std:: allows the compiler to recognise that the standard library endl is what you are looking for.