It could be that std::strings are not null terminated. They have a method length() for that.
By the way, you realise that this is far from what a function called "equals" should do, right?
1) A function called equals should test to see if the two strings are equal, which I believe is what you are attempting to do, however it doesn't actually get done here.
2) Strings are containers. They aren't "terminated" so much as they are a list of characters, and anything past the end just returns either a null_ptr or an undefined result (depending on your compiler)
3) You shouldn't return i == j; from int equals(std::string, std::string); function, you'd want to return that evaluation from bool equals(std::string, std::string);