You can play with your friend planning on XBox One if (& ONLY IF) you have the Windows 10 version of Minecraft, as it's running on the Bedrock Engine (that the XBox One, Switch & Mobile versions runs on). Just make sure you & your friend have exchanged XBox Live usernames
If you have Java version of Minecraft, you won't be able to play with them. HOWEVER, if you purchased the Java version PRIOR to October 19th, 2018, you are eligible to get the Windows 10 version for FREE. You'll need to log into your Mojang account in order to get your key to use with the Windows Store... but Mojang & the Minecraft website will guide you through the process.