
20 Cal.2d 488 (1942)
O. B. ROUTH, Appellant,
v.
JOHN R. QUINN et al., Respondents.
L. A. No. 18215. 
Supreme Court of California. In Bank.  
June 30, 1942.
 Combs & Murphine for Appellant.
 J. H. O'Connor, County Counsel (Los Angeles) and Gordon Boller and A. Curtis Smith, Deputy County Counsel, for Respondents.
 CARTER, J.
 The controversy presented by this appeal is whether a tax assessor, his deputy and bondsman are liable to a purchaser of personal property at a delinquent tax sale for damages suffered by him due to the invalidity of the sale alleged to have resulted from negligence on the part of the assessor and his deputy in the computation of the tax payable.
 Plaintiff appeals from a judgment of dismissal entered after defendants' demurrer was sustained without leave to amend.
 Plaintiff charged in his complaint that on June 24, 1938, defendants county tax assessor and his deputy sold to plaintiff certain personal property consisting of a dehydrating plant by means of a delinquent tax sale at public auction for $250; that the delinquent tax for which the property was sold was assessed against said personal property, the correct amount of which was $83.57; that the assessor and his deputy *490 "negligently ... claimed a tax (on said property) of $84.36 at ... said sale ...; that said excessive sum was claimed by ... an error carelessly and negligently made by defendants ... in the computation of said tax; that said defendants negligently computed said tax in that they failed to carry the same out to the correct number of decimal places in the computation thereof"; that as a result of the erroneous computation the sale was void and the owner of the property, Becker, recovered judgment for $4,500 against plaintiff for the wrongful conversion of said property. Plaintiff now claims damages resulting from the negligence of defendants in the sum of $14,500 consisting of the above-mentioned judgment, the expense of defending the action brought by Becker, and other damages flowing from that action. Plaintiff received a bill of sale for the property from the assessor which recited that it was sold pursuant to sections 3820, 3821 and 3822 of the Political Code.
 Plaintiff relies upon the general proposition that a public officer is liable to respond in damages to one specially injured by his neglect to perform or negligent performance of an official ministerial duty to the extent of such special injury. (21 Cal.Jur. 908.)
 Plaintiff points to section 3823 of the Political Code as imposing the duty upon the tax assessor to compute correctly the amount of the tax on personal property. Assuming that such a duty is imposed upon the assessor, and that the act of computing the amount of the tax, that is, the application of the rate of tax to the assessed value of the property is a purely ministerial function, still we are of the opinion that plaintiff has failed to state a cause of action.
 [1a] The fundamental principle from which springs the reasons why a purchaser at a delinquent tax sale may not recover damages suffered as a result of the alleged negligence of the assessor in the computation of the amount of tax, is that in tax sales the doctrine of caveat emptor applies in all its vigor. A purchaser of property at a tax sale takes the risk of any defect in the proceedings in the taxation process. No warranty of the validity or regularity of the proceedings exists. (See Holland v. Hotchkiss, 162 Cal. 366, 373-374 [123 P. 258; L.R.A. 1915C, 492]; 61 C.J. 1304; 4 Cooley on Taxation, 4th ed.,  1553; 77 A.L.R. 824; 116 A.L.R. 1408.) Prior to the amendment in 1913 of section 3898 of the Political Code, it was the rule in this state that the purchaser at a tax *491 sale could not recover from the county or state the amount paid, although the sale was void because of some irregularity in the process of the levy or collection of the tax or the sale of the property. (Coleman v. County of Los Angeles, 180 Cal. 714 [182 P. 440]; Loomis v. County of Los Angeles, 59 Cal. 456; Brooks v. Tulare County, 117 Cal. 465 [49 P. 469]; Holland v. Hotchkiss, supra; Moyer v. Wilson, 166 Cal. 261 [135 P. 1125].) That rule was founded upon the application of the doctrine of caveat emptor. (See Brooks v. County of Tulare, supra.) The rule was relaxed by the 1913 amendment to section 3898 of the Political Code with respect to the recovery from the county by the purchaser of the amount paid at the tax sale in excess of the taxes lawfully due. (See Pol. Code,  3898; Coleman v. County of Los Angeles, supra.) But that statute must be strictly complied with and permits only the recovery there authorized. (See Coleman v. County of Los Angeles, supra.) There is no statute authorizing recovery against the tax assessor. If the money paid at the sale by the purchaser cannot be recovered from the county or state except by statutory authority, surely for the same reason, caveat emptor, no recovery could be had against them for the negligence of their officers in the computation of the tax. While plaintiff's action is against the tax assessor as an individual, rather than the county, the same rule extends to protect the assessor. (See Foster v. Malberg, 119 Minn. 168 [137 N.W. 816, Ann. Cas. 1914A, 1116, 41 L.R.A. (N.S.) 967].) Reason supports that conclusion inasmuch as the assessor is merely the agent for the county and is not purporting to pass any title in his individual capacity. The doctrine of caveat emptor being the basis for the absence of liability, the same doctrine would protect both the political entity and the officer. It is for that reason distinguishable from the cases where the state is not liable for a tort but the officer is, the non-liability being based upon the doctrine of sovereign immunity.
 [2] It is an elementary principle that an indispensable factor to liability founded upon negligence is the existence of a duty of care owed by the alleged wrongdoer to the person injured, or to a class of which he is a member. (Dahms v. General Elevator Co., 214 Cal. 733 [7 P.2d 1013]; 19 Cal.Jur. 550-551.) A particular application of that rule finds expression in the principle that a duty imposed by a statute may not be the foundation for actionable negligence in the performance *492 of that duty unless it is owed to the person injured, or to a class of which he is a member, or stated another way, a violation of a statute is actionable negligence only as to those persons for whose benefit or protection it was enacted. (King v. San Diego Electric Ry. Co., 176 Cal. 266 [168 P. 131]; 19 Cal.Jur. 635; Restatement, Torts,  286, 288.)
 [1b] We have assumed that the duty to exercise care in the computation of the tax is imposed upon the tax assessor by section 3823 of the Political Code. But that duty is not owed to a purchaser of property at a delinquent tax sale. Such duty would be owed only to the public as an entity in making secure the public revenues and expediting the taxation process as distinguished from the individual members of the public, and possibly to the owner of the property upon which the tax had been levied. There may well be a duty, under proper circumstances, upon the officer making the tax sale of land to execute a proper deed to the purchaser, when the taxation proceedings leading to the sale have been regular and valid (Webster v. Somer, 159 Cal. 459 [114 P. 575]; Fox v. Townsend, 152 Cal. 51 [91 P. 1004, 1007]; Smart v. Peek, 213 Cal. 452 [2 P.2d 380]), but the computation of the tax in such a case is made, of course, before there is a sale, and before the purchaser becomes entitled to an instrument of transfer. These conclusions with respect to the duty of care necessarily follow from the application of the doctrine of caveat emptor to the purchaser. While that doctrine relates to the existence of warranties in the sale of property, which, of course, are contractual in nature, it seems clear that if there are no warranties made by the state with reference to the regularity in computing the tax, there are none made by the assessor, the agent of the state. If they do not warrant or make any holding out as to the regularity of that computation, as to the purchaser, neither is under any duty of care with respect to him. As he is not entitled to any assurance of the regularity of the tax proceedings, he is not entitled to insist that due care be exercised by the assessor or the county. The statute does not impose such a duty upon him as to the purchaser. Nor is there any other source from which such a duty may arise. Sound public policy dictates that no such intolerable burden shall be placed upon a tax assessor that will make him liable for any error he may make in the computation of the tax. The multitude of transactions with which he must deal and the great probability that mathematical error may well *493 creep into the calculations regardless of his competency and efficiency, refutes the wisdom of imposing such duty upon him.
 A further ground for the absence of liability of the tax assessor flows from the application of the doctrine of caveat emptor. The essence of that doctrine is that the buyer beware; that he is bound to inform himself of the regularity of the tax proceedings, and that he assumes the risk of any error in the computation of the tax. Assumption of the risk out of which an injury arose by the person injured has consistently been held to bar recovery in an action for the injury alleged to have been negligently caused. (See 19 Cal.Jur. 583.)
 [3] It is true that assumption of risk, like contributory negligence, ordinarily must be pleaded as a defense and may not be the grounds for sustaining a demurrer to the complaint, such as is now before us. But where, as in the case of contributory negligence, that negligence appears as a matter of law on the face of the complaint, a demurrer is sustainable on that ground. (Nicolosi v. Clark, 169 Cal. 746 [147 P. 971, L.R.A. 1915 F, 638].)
 Courts in two other states have on various grounds denied recovery from a tax official by a purchaser at a delinquent tax sale in actions where improperly performed duty was charged. (Foster v. Malberg, supra; Hamilton v. Valiant, 30 Md. 139.) Although the action in the Foster case was against the tax official and the sureties on his bond, the discussion there in denying liability is particularly pertinent. The officer failed to give proper notice of the tax sale, with the result that it was void to the purchaser's injury. The basis of nonliability was founded upon contributory negligence, lack of proximate cause, and absence of duty of care, all emanating from the application of the doctrine of caveat emptor. The Foster case was cited with approval in Judd v. City of St. Cloud, 198 Minn. 590 [272 N.W. 577].
 It follows, of course, under the circumstances, that if the assessor is not liable neither is his deputy or bondsmen.
 [4] Plaintiff complains that the court abused its discretion in refusing to permit him to amend his complaint. There was no abuse of discretion. From plaintiff's complaint the basis of plaintiff's action is clear, that is, negligence in the calculation of the amount of the tax claimed against the property involved. Inasmuch as we have determined that no cause of action exists for such alleged negligence, there are no circumstances *494 under which an amendment would serve any useful purpose.
 The judgment is affirmed.
 Gibson, C.J., Shenk, J., Curtis, J., Edmonds, J., and Traynor, J., concurred.
