You've been misinformed. Xcode has always had a C++ compiler.
Xcode included clang, the llvm C and C++ compiler; which is on a par with the GNU compilers for support of the latest standards and reported to be better at code generation.
Early versions of Xcode used the GCC compilers for C and C++. Several years ago, they moved to llvm, supporting both toolchains for a while before dropping GCC altogether.
As an earlier answer suggested, you can get GNU GCC for the Mac, if you want. Either way, I don't think you'll get much support for graphical applications. Not from Xcode, anyway. If you need an application that runs in a window. You're probably better off using a third-party framework like Qt.
Installing Xcode used to be the easiest way to get a C++ compiler onto a Mac; and maybe still is. So, even if you plan to use another IDE--such as Qt Creator--to develop your application, you might be installing Xcode anyway.