Usually, only Player Characters have classes
While some monster stat blocks might have features that are analogous to a player class, they are not of that class. A monster's stat block should contain all the rules for that monster, and typically giving them full class levels would require more space than would be convenient. So, in official books, this simply isn't done.
For example, see the Mage (MM p.347). The Mage is a 9th-level spellcaster, as specified by their Spellcasting trait, and they have wizard spells prepared, but they are not a wizard. They do not have Arcane Recovery, for example, or any other class features of a wizard besides their Spellcasting trait.
Looking further, see the Spy (MM p.349). This is clearly based off a rogue, with a plethora of skills, Sneak Attack, and Cunning Action. But they have neither Thieves' Cant, nor proficiency in Thieves' tools. Despite borrowing traits from the rogue, the Spy is not a rogue.
You can add class levels to a monster, but...
Using the rules on Monsters with Classes from the DMG (p.283,) you can add class levels to any monster you'd like. The basic process for this is to simply add the class features from the class of your choice to the stat block. There is no need to add the class itself to the stat block; you've already added the relevant information (what the monster can do.)
To phrase all this another way: Player characters keep track of their classes because they change and grow, and must handle all kinds of metadata to make that happen smoothly. A normal monster does not change, so only the mechanically relevant information is listed on the stat block. Whether the monster is a bard isn't relevant; what bard features it has is relevant.
As of Boo's Astral Menagerie
Since this answer was written, there is now an official way to note class in the stat block. You can note it next to the creature type, such as:
Medium Humanoid (Gith, Warlock), Any Alignment
Be aware that, like this answer originally said, this does not imply that the monster has the abilities of that class. The only mechanical effect is to allow the creature to meet class prerequisites for the purposes of attuning to magic items.