Can I invite guests in the flat I rented?

Sure, if the flat allows you to have guests, for example having a nice sofa-bed in the living room you are more than welcome in having them to sleep over. What landlords want to clarify is that a guest is a guest if he or she stays in the flat a limited amount of time, one or two weeks, just to give an idea. A person staying in the flat for months coudl be correctly interpreted as a new additional tenant and the landlord could complin you breached the rental contract you signed. 

The best way to behave is always to be extremely transparent and inform the landlord if a friend or your brother, for example, is staying over for a couple of months to attend a university course or anything else.