You need to understand how snap bases work: For example, base: 22
corresponds to Ubuntu 22.04LTS and makes the packages from that archive available. As Ubuntu 22.04LTS predates g++13, the g++-13
package isn’t available from that archive.
It is already possible to use base: 24
for testing, and that does include g++13.
Alternatively, you could add a PPA containing g++13 to your snap recipe. Such as https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test.