Do note, you'll likely want to be different base classes, because if you're the same you won't be able to do your class quests together.
Like, a Jedi Knight and a Jedi Knight will be locked out of each others' class quest areas. But a Trooper and a Jedi Knight could definitely enter together an help each other. That only applies to the class quests and no others.
Actually you can, but it's just more tricky. There is a setting that you can switch on that will allow you to enter the same class story phases if grouped, but only the first person to enter the story phase will get their quest done. So if you play together using the same classes you will have to do all of the class story quests twice.
Note: The different advanced classes of the same class will still count as the same class
For the reason of not getting bored with repeating the same stuff, I would still highly recommend using different classes.