A generalized beam theory with shear deformation