
182 Conn. 526 (1980)
PETERS PRODUCTION, INC.
v.
KENNETH DAWSON ET AL.
Supreme Court of Connecticut.
Argued November 12, 1980.
Decision released December 16, 1980.
COTTER, C. J., BOGDANSKI, PETERS, HEALEY and PARSKEY, JS.
Glenn T. Terk, for the appellants (defendants).
Ira B. Charmoy, for the appellee (plaintiff).
PER CURIAM.
The plaintiff corporation, having obtained three judgments against the defendants in California based on a breach of contract, brought the present action in five counts. Three counts alleged that the California judgments were unsatisfied; two others alleged original causes of action for breach of contract. By way of special defense, the defendants attempted to raise the issue of whether the plaintiff was barred from maintaining this *527 action by General Statutes § 33-412, which prohibits any foreign corporation transacting business in Connecticut in violation of § 33-396 from bringing a lawsuit in Connecticut without obtaining a certificate of authority to transact business in this state from the secretary of the state. The defendants also filed a counterclaim alleging a breach of contract by the plaintiff. Although the trial court declined to award damages on the counts alleging an original breach of contract, it found for the plaintiff on two of the counts which were based on the California judgments and also found for the plaintiff on the counterclaim. The defendants appealed from the judgment rendered for the plaintiff on the two counts of its complaint. The appeal as to one of these counts was withdrawn at oral argument. Thus the only part of the judgment remaining for our consideration is against ADS Broadcasting Corp., Inc., in the amount of $2771.23 plus interest and costs taxed at $628.10.
The facts underlying the parties' dispute are not seriously contested. The defendant agreed with the plaintiff to subscribe to a service provided by the plaintiff for tapes of music, reels, containers and other material to be used at the defendant's radio station in Ansonia. The defendant paid $720 to the plaintiff as a security deposit. In addition, monthly rentals were to be paid by the defendant as agreed upon by the parties. The trial court found that judgment had been entered in the amount of $2771.23 for the plaintiff in California based on the defendant's breach of the agreement and rendered judgment accordingly.
The defendant now argues that the security deposit should have been allowed as a credit or *528 setoff against the damages awarded by the California judgment. We cannot agree. In order to have the benefit of a right of setoff, a defendant must affirmatively raise his claim in the pleadings. Practice Book, 1978, § 168; Sturges v. Wagner, 109 Conn. 1, 5, 144 A. 471 (1929). Although the defendant in the present case filed a counterclaim, no facts were pleaded which could support a claim that the defendant was entitled to have the security deposit either returned outright or credited as a setoff against the plaintiff's damages. Because such a claim was not raised in the pleadings, the trial court did not err in declining to credit the security deposit against the damages awarded to the plaintiff. We note that, had this issue been properly joined by the pleadings, the trial court undoubtedly could have explored more fully the strength of the defendant's right to the security deposit in the face of the undisputed fact that the materials for which the deposit was paid have not been returned to the plaintiff.[1]
The second claim pursued by the defendant on appeal is that the trial court erred in concluding that the allegations of one of the defendant's special defenses were insufficient. This defense was *529 injected into the case by a special defense which asserted that (1) the plaintiff was a California corporation; (2) the plaintiff had not procured a certificate of authority to transact business in Connecticut from the secretary of the state; and (3) the plaintiff was, therefore, barred from bringing the present action. The statutory foundation for this defense is General Statutes § 33-412 (a) which provides in part that "[n]o foreign corporation transacting business in this state in violation of section 33-396[2] shall be permitted to maintain any action, suit or proceeding in any court in this state unless such corporation has obtained a certificate of authority."
An inspection of the allegations of the special defense reveals that the defendant failed to allege that the plaintiff was transacting business in this state. The absence of this key element from the pleadings renders the special defense insufficient as a matter of law because a corporation which is not transacting business in this state may freely bring and maintain a lawsuit without offending General Statutes §§ 33-396 and 33-412 (a). Eljam Mason Supply, Inc. v. Donnelly Brick Co., 152 Conn. 483, 486, 208 A.2d 544 (1965). The transacting business element is an especially important one to be properly pleaded at trial because whether a foreign corporation is transacting business so as to require a certificate of authority is a question which must be resolved by examining the complete factual circumstances of each case. Sawyer Savings Bank v. America Trading Co., 176 Conn. 185, 190, 405 A.2d *530 635 (1978). Further, as the plaintiff points out, had this factor been adequately raised in the pleadings the plaintiff would have had the opportunity to prove that its conduct fell within one or more of the categories of activity expressly declared by General Statutes § 33-397 not to constitute transacting business. The trial court correctly concluded that the defendant had not properly pleaded this special defense.
There is no error.
NOTES
[1]  The relevant language of the contract concerning the security deposit states: "Subject to the provision of Paragraph 7, in the event that SUBSCRIBER has not breached any of the terms and conditions of this Agreement and has performed all of its obligations hereunder, the security deposit shall be returned to SUSCRIBER at the end of this Agreement. In the event SUBSCRIBER is in default of any of its obligations hereunder, in addition to its other remedies, PPI may apply said security deposit against any service charges or other fees, costs, expenses, and damages owed by SUBSCRIBER, and SUBSCRIBER shall immediately restore said security deposit to the full amount required hereunder." Paragraph seven of the agreement states that in the event of cancellation of the agreement, the tapes in the possession of the defendant were to be returned to the plaintiff.
[2]  General Statutes § 33-396 provides in part that "[n]o foreign corporation except an insurance or surety or indemnity company shall transact business in this state until it has procured a certificate of authority so to do from the secretary of the state."
