Probably, but why?
Per the Magic jar Spell:
Once you possess a creature's body, you control it. Your game statistics are replaced by the statistics of the creature, though you retain your alignment and your Intelligence, Wisdom, and Charisma scores. You retain the benefit of your own class features. If the target has any class levels, you can't use any of its class features.
If the host body already has class levels, you cannot count them. If they don't have class levels, then they are a nondescript extra. So either way, you are basically a blank slate. We need to find rules on someone that had a life before and has just started their path as an adventurer. Like an NPC?
NPC Party Members
NPCs might join the adventuring party because they want a share of the loot and are willing to accept an equal share of the risk, or they might follow the adventurers because of a bond of loyalty, gratitude, or love.
[...]
Any NPC that accompanies the adventurers acts as a party member and earns a full share of experience points.
These NPCs should be the same level as the lowest-level adventurer in the party and built (either by you or your players) using the character creation and advancement rules in the Player’s Handbook.
Per the rules, an NPC can use the character creation rules and become 1st level in some class. And since they gain an equal share of experience, they also follow the advancement rules.
So you decide that, per the rules, this host is going to become a 1st level Cleric. That's awesome because as a 1st level Cleric, they gain spells, cantrips, some divine powers... But wait...
If the target has any class levels, you can't use any of its class features
That rule doesn't change just because you chose a class to level up. You could spend the rest of your days gaining Cleric levels in the host, but you would never see any benefit from it sans the every-four-level-ASI and more hit points (maybe take levels in Barbarian?). And then the host dies, or the container is broken, your soul comes rushing back to your original body... and you lose all that experience (including the ASI and hp).
Experience points are an abstraction of the game to quantify learning and muscle memory. Same way hit points are an abstraction of health, well being, and fortitude. Since it wasn't your body that learned how to better swing a sword, cast a spell, or sing a song, you don't get the "experience" of having done so. Even though you leveled up the host through the ranks of a class, you could not use any of its features and therefore never learned how to do any of those features.
You got to vicariously live the life of a Cleric, but that's all you really gained.