I am using Visual Studio 19. The code compiles and runs fine.
From https://stackoverflow.com/questions/16506095/do-i-have-to-use-include-string-beside-iostream
Visual Studio 19 probably uses a more advanced C++ compiler where string is already included in iostream.
Thanks.