C++的string类的substr函数发生错误(新手)

出错代码: if (year == p->YearAndMonth.substr(0, 4)) {
FeePaid += p->FeeSum;
FeePayable += p->Fee;
}
year是string类(2016),p是指向一个结构体的指针,YearAndMonth是结构体里的成员变量,也是string类(201601)。
我想要截取YearAndMonth的前四个字符和year比看是否一样,一样就执行累加运算(计算一年的物业账单费用总合)
不知道那里错了。是不是p->YearAndMonth.substr(0, 4)这一段要加括号什么的

函数全代码:
int People::Count(string year,int n) {
List *p=PHead;
int FeePaid=0;//业主年度已交
int FeePayable=0;//业主年度应交
while (p!= NULL)
{
if (year == p->YearAndMonth.substr(0, 4)) {
FeePaid += p->FeeSum;
FeePayable += p->Fee;
}
p = p->Pnext;
}
if (n == 1) return FeePaid;//接收1返回已交
else return FeePayable;//否则返回应交
}