A restaurant is where you sit to enjoy a meal in sufficient comfort and leisure. In a fast food unit, you sit briefly, often with your food still in a bag or plastic box. You do not have proper cutlery and you may have to put up with a dirty table, or even have to stand and eat at a ledge. You will not be served by a waiter and you will be expected to move on as soon as you've gulped down the last bite. Finally, you will be expected to throw away the packaging your meal came in. This is hardly eating in comfort or at leisure. I would therefore not call a fast food joint a restaurant.
Fast food places are considered restaurants based on the definition of a restaurant. It is an establishment that was built for that intended purpose. Restaurants serve food, but they usually serve a whole meal. Based on the definition, there is a fine line between a restaurant and a bakery. Bakeries do serve food to customers who in return pay for them just like a restaurant does. However, bakeries usually do not serve a whole meal. They specialize in one thing…baked sweet goods or breads.
Also, people usually do not sit down at a bakery to eat. They usually take it home. Today, meals can also be bought at grocery stores. They are not restaurants because the entire store was not built for the purpose of selling ready-made meals.