Every defense, in law or fact, to a claim for relief in any pleading, whether a complaint, counterclaim, cross-claim or third-party complaint, shall be asserted in the responsive pleading thereto, if one is required, except that the following defenses may at the option of the pleader be made by motion: (1) lack of jurisdiction over the subject matter; (2) lack of jurisdiction over the person; (3) insufficiency of process; (4) insufficiency of service of process; (5) failure to state a claim upon which relief can be granted; (6) failure to join an indispensable party. A motion making any of these defenses shall be made before pleading, if a further pleading is permitted. No defense or objection is waived by being joined with one or more defenses or objections in a responsive pleading or motion. If a pleading sets forth a claim for relief to which the adverse party is not required to serve a responsive pleading, he may assert at the trial any defense in law or fact to that claim for relief. If, on a motion asserting the defense numbered (5), matters outside the pleading being attacked are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 36 until its final disposition, and all parties shall be given reasonable opportunity to present all material pertinent to such motion under said rule.