Attached garages or accessory buildings connected with the main building by a breezeway or other permanently constructed connection shall be construed to be part of the main building for the purposes of this section. All other accessory buildings shall be at least ten feet from any dwelling. However, an accessory building located not less than ten feet to the rear of the main building may be erected not less than five feet from a side lot line, except on a corner lot, provided it will not be less than ten feet distance from any existing dwelling. An accessory building is a subordinate building customarily incident to and located on the same lot with the main building. No accessory building in a residential district shall exceed in height the height of the main building constructed on the premises or eighteen feet whichever is lesser.