The conjunction “if” has the same sense as “whether” when used in an indirect question that doesn’t provide a stated or implied alternative, as in your sentence “She asked me if I could accompany her to her brother’s birthday party.” When the indirect question provides a stated of implied alternative, however, the conjunction “whether” can be used but usually with the correlative “or,” as in this version of that sentence: “She asked me whether or not I could accompany her to her brother’s birthday party.” In polite or comradely society, though, it’s not advisable—indeed it might sound abrasive or be perceived as abrasive—to use “or not” in requests of that kind, so it’s idiomatic to drop “or not” altogether: “She asked me whether I could accompany her to her brother’s birthday party.” It’s in this sense that “if” becomes interchangeable with “whether.”