To play multiplayer with friends on State of Decay 2, you will first need to create a community and get past the initial tutorial.
You only need to get past the tutorial once, and after that, players will be free to create a custom community with custom characters chosen randomly.
That said, create your community and then load into your game and hit ESC or the menu button. A list of options should appear shortly after. Click the one that says settings and then multiplayer.
From the multiplayer tab, you will be able to open your current game to your friends by inviting them. However, before you can invite your friends with this option, you will need to hit host multiplayer game.
Be warned though, doing so will turn off pause, so it might be ideal to do this from your base or a safe location to avoid unnecessary death. So get to a safe location if you haven't already, and then hit open to friends and host multiplayer.
Once multiplayer is enabled, go back to the ESC menu section and look under your profile at the top left of your screen, as shown below.
You should see something that says invite a guest. If you don't try hovering below your profile - when you find the option, click where it says send invite.
Doing so will open an Xbox friends tab, and you will be able to find your friend and invite them to your game to play co-op. Once they accept your invite, that will be it for how to play co-op in State of Decay 2.
For more on State of Decay 2, check out our other awesome guides!