In an action to recover damages for an injury by accident arising out of and in the course of employment which was sustained by an employee, who is an employee subject to the provisions of the workmen's compensation act other than by election filed pursuant to K.S.A. 44-542a, or for death resulting from an injury so sustained, in which recovery is sought upon the ground of want of due care of the employer or of any officer, agent or servant of the employer and where such employer at the time of the accident was subject to the provisions of the workmen's compensation act, it shall be a defense for such employer in all cases where said employee has elected not to come within the provisions of the workmen's compensation act pursuant to a valid declaration of election as provided in K.S.A. 44-543:
K.S.A. 44-545