I have minecraft on my pc, and i able to play with my friend who has an xbox?

I just got my Pc set up and logged into my old minecraft account so i could play, and my buddy whp has an xbox says we can together despite having different systems. Is this true? And if so, how do we connect to play?

I don't believe so

If you have the windows 10 version, then yes, you can. I think you have to set up an Xbox Live account for Windows 10 to use the sharing.

If you have the Java version of Minecraft, then you can't.

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.